#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>

int cmp(void* a, void* b)
{
    return ((int*)a)[1] - ((int*)b)[1];
}
int main()
{
    int a[20][20] = { 0 };
    int r, c;
    scanf("%d %d ", &r, &c);
    for (int i = 1; i <= r; i++)
    {
        for (int j = 1; j <= c; j++)
        {
            scanf("%d", &a[i][j]);
        }
    }
    int b[200][3] = { 0 };
    int cnt = 0;
    for (int i = 2; i <= r-1; i++)
    {
        for (int j = 2; j <= c-1; j++)
        {
            if ((a[i][j] > a[i][j - 1])
                && (a[i][j] > a[i][j + 1])
                && (a[i][j] > a[i + 1][j])
                && (a[i][j] > a[i + 1][j]))
            {
                b[cnt][0] = a[i][j];
                b[cnt][1] = i + 1;
                b[cnt][2] = j + 1;
                printf("%d %d %d\n", b[cnt][0], b[cnt][1], b[cnt][2]);
                cnt++;

            }
        }
    }

    qsort(b, cnt, sizeof(b[0]), cmp);

    for (int i = 0; i < cnt; i++)
    {
        printf("%d:", i);
        for (int j = 0; j < 3; j++)
        {
            printf(" %d", b[i][j]);
        }
    }
    return 0;
}